
#ifndef __RGBTABLE_H__
#define __RGBTABLE_H__

#include <ddraw.h>

#include "basetype.h"

#include "ObjInst.h"

class CRgbTable
{
public:

	CRgbTable()
	{
	}

	~CRgbTable()
	{
	}

	//
	int Rgb_16_8_Indexed_Builder(int rgb_format,             // format we want to build table for
									  // 99/100 565
								LPPALETTEENTRY src_palette); // source palette

	int Rgb_16_8_Indexed_Intensity_Table_Builder(LPPALETTEENTRY src_palette,  // source palette
												int intensity_normalization = 1);

	int RGBto8BitIndex(UCHAR r, UCHAR g, UCHAR b, LPPALETTEENTRY palette, int flush_cache = 0);

protected:
	
	uint8 rgbilookup[256][256];         // intensity RGB 8-bit lookup storage
	uint8 rgblookup[65536];             // RGB 8-bit color lookup
};

typedef CObjInst<CRgbTable>		RgbTableInst;

#endif